package ws.performancetest.tests.jdbcdriver.runnable;

import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Wilson Santos, <wilson.santos@ua.pt>
 */
public class DeleteRunnable extends ResultSetRunnable {

  @Override
  public void run() {
    try {
      int firstLine = counter.getAndAdd(linesPerThread);
      int lastLine = firstLine + linesPerThread - 1;
      rs.absolute(firstLine - 1);
      for (int i = firstLine; i <= lastLine; ++i) {
        rs.next();
        rs.deleteRow();
      }
    } catch (SQLException ex) {
      Logger.getLogger(DeleteRunnable.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
}
